package com.huashi.dealer.modular.business.order.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huashi.dealer.commonEntity.OrderExpress;
import com.huashi.dealer.modular.business.order.mapper.OrderExpressMapper;
import com.huashi.dealer.modular.business.order.service.OrderExpressService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 订单物流信息Service实现类
 */
@Service("apiOrderExpressServiceImpl")
public class OrderExpressServiceImpl extends ServiceImpl<OrderExpressMapper, OrderExpress> implements OrderExpressService {

    @Override
    public Page<OrderExpress> getOrderExpressList(Page<OrderExpress> page, Long orderId) {
        LambdaQueryWrapper<OrderExpress> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(OrderExpress::getOrderId, orderId)
                   .orderByDesc(OrderExpress::getCreateTime)
                   .orderByDesc(OrderExpress::getDeliveryTime);
        
        return this.page(page, queryWrapper);
    }
}